<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>电影放映</title>
</head>
	<link href='static/css/style.css' rel='stylesheet' />
	<script src='3rd/jquery/jquery-3.4.1.min.js'></script>
	<script src='layer/layer.js'></script>
	<script src='3rd/bootstrap/js/bootstrap.min.js'></script>
	<script src='static/js/login.js'></script>
	<link href='3rd/bootstrap/css/bootstrap.min.css' rel='stylesheet'>
	<style type="text/css">
		table{
			width: 600px;
			margin: auto;
			border-collapse: collapse;
			border: black 1px solid;
		}
		td{
			border: black 1px solid;
			padding: 10px;
		}
		th{
			border: black 1px solid;
			padding: 10px;
		}
		.navbar {
			margin-bottom: 0;
		}
	</style>
<body>
	<div class='row '>
		<nav class='navbar navbar-inverse'>
			<div class='navbar-header'>
				<button type='button' class='navbar-toggle collapsed' data-toggle='collapse' data-target='#bs-example-navbar-collapse-1'
				 aria-expanded='false'>
					<span class='sr-only'>Toggle navigation</span>
					<span class='icon-bar'></span>
					<span class='icon-bar'></span>
					<span class='icon-bar'></span>
				</button>
				<a class='navbar-brand' href='${pageContext.request.contextPath}/pages/index.jsp'>千锋影棚</a>
			</div>

			<div class='collapse navbar-collapse' id='bs-example-navbar-collapse-1'>
				<!-- <ul class='nav navbar-nav'>
					<li class='active'><a href='#'>热门 <span class='sr-only'>(current)</span></a></li>
					<li><a href='movie.jsp'>影片</a></li>
				</ul> -->
				<form class='navbar-form navbar-left'>
					<div class='form-group'>
						<input type='text' class='form-control' placeholder='输入关键字'>
					</div>
					<button type='submit' class='btn btn-default'>搜索</button>
				</form>
				<ul class='nav navbar-nav navbar-right'>
					<li><a href='#' id='bLogin'></a></li>
					<li class='dropdown'>
						<a href='#' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-haspopup='true' aria-expanded='false'>${user.username}<span
							 class='caret'></span></a>
						<ul class='dropdown-menu'>
							<li><a href='${pageContext.request.contextPath}/cinema?action=order&page=1'>订单记录</a></li>
							<li><a href='${pageContext.request.contextPath}/user?action=exit'>退出</a></li>
						</ul>
					</li>
				</ul>
			</div>
		</nav>
	</div>
	<c:if test="${not empty showsList}">
		<table id="table_1">
			<caption>
				<h1>电影放映</h1>
			</caption>
			<tr id="tr_1">
				<th>编号</th>
				<th>放映厅</th>
				<th>放映时间</th>
				<th>剩余票数</th>
				<th>总票数</th>
				<th>操作</th>
			</tr>
			<c:forEach var="shows" items="${showsList}">
				<tr>
					<td>${shows.id}</td>
					<td>${shows.showRoom}</td>
		   			<td>${shows.showTime}</td>
		   			<td>${shows.ticketNum}</td>
		   			<td>${shows.ticketTotal}</td>
		   			<td>
		   				<a href= "${pageContext.request.contextPath}/cinema?action=seat&sid=${shows.id}">选座购票</a>
		   			</td>
				</tr>
			</c:forEach>
		</table>
		<font>
			<center>
				${showsPage.currentPage}/${showsPage.totalPage}页&emsp;
				<a href='${pageContext.request.contextPath}/cinema?action=showSeat&page=1&id=${id}&ticketPrice=${ticketPrice}'>首页</a>&emsp;
				<a href="${pageContext.request.contextPath}/cinema?action=showSeat&page=${showsPage.currentPage-1}&id=${id}&ticketPrice=${ticketPrice}">上一页</a>&emsp;
				<a href="${pageContext.request.contextPath}/cinema?action=showSeat&page=${showsPage.currentPage+1}&id=${id}&ticketPrice=${ticketPrice}">下一页</a>&emsp;
				<a href="${pageContext.request.contextPath}/cinema?action=showSeat&page=${showsPage.totalPage}&id=${id}&ticketPrice=${ticketPrice}">末页</a>
			</center>
		</font>
	</c:if>
	<c:if test="${empty showsList}">
		<table>
			<caption>
				<h1>该电影近期没有放映安排</h1>
			</caption>
		</table>
	</c:if>
</body>
</html>